package com.dingup.provider.service.student.impl;

import com.dingup.api.model.student.StudentOtherInformation;
import com.dingup.provider.mapper.StudentOtherInformationMapper;
import com.dingup.provider.service.student.StudentOtherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by wancheng on 2018/8/17.
 */
@Service
public class StudentOtherServiceImpl implements StudentOtherService{

    @Autowired
    StudentOtherInformationMapper studentOtherInformationMapper;

    @Override
    public void saveStudentOtherInformation(StudentOtherInformation studentOtherInformation) {
        studentOtherInformationMapper.insertSelective(studentOtherInformation);
    }

    @Override
    public void updateStudentOtherInformation(StudentOtherInformation studentOtherInformation) {
        studentOtherInformationMapper.updateByPrimaryKeySelective(studentOtherInformation);
    }

    @Override
    public StudentOtherInformation getStudentOtherInformation(String studentId) {
        StudentOtherInformation studentOtherInformation = studentOtherInformationMapper.getByUserId(studentId);
        if (studentOtherInformation != null){
            studentOtherInformation.setCreateTime(null);
            studentOtherInformation.setUserId(null);
        }
        return studentOtherInformation;
    }
}
